import tiyData from "./init_web_data";
import ApiBase from "../../../api/moudles/ApiBase";
export const init = (tiyData) => {
  tiyData.tParams.uploadParam = {};
  tiyData.tStatus.modalImport.isShow = false;

};


export const createPage = (self,index) => {
  self.$Spin.show();
  let requestUrl = self.$store.getters.webDomain+self.pageType[index].value;
  ApiBase.send(requestUrl,{}).then(response => {
      if(response.success) {
        self.$Message.success("页面生成完成！");
        if(response.result&&response.result.hasOwnProperty("linkUrl")){
          self.pageType[index].linkUrl=response.result.linkUrl;
        }


      }else{
        self.$Message.error(response.errorMessage);
      }
      self.$Spin.hide();
    }

  )
};
export const clearCache = (self,tiyData) => {
  self.$Spin.show();
    let requestUrl = self.$store.getters.webDomain+
    "main/delRedisCache.do?code=shidai_912&isCommon=false&keys="+encodeURIComponent(JSON.stringify(tiyData.tData.caches[tiyData.tParams.currentCache].value));
  ApiBase.send(requestUrl,{}).then(response => {
      if(response.success) {
        self.$Message.success("缓存已清理！");
      }else{
        self.$Message.error(response.errorMessage);
      }
      self.$Spin.hide();
    }

  )
};
